import 'package:async/async.dart';
import 'package:boss/main.dart';
import 'package:boss/models/takeout_order_list_data.dart';
import 'package:flutter/material.dart';

class TakeoutDetailProvider extends ChangeNotifier {
  TakeoutOrderItem data;

  Future<Result> queryTakeoutDetailById(String takeoutId) async {
    try {
      final res = await api.queryTakeOutOrderByTakeId(takeoutId);

      if (!res.successful()) {
        return Result.error(res.msg);
      }

      data = res.data;

      return Result.value(res.data);
    } catch (e) {
      return Result.value('数据解析失败');
    }
  }
}
